/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package action.organization;

import com.opensymphony.xwork2.ActionSupport;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.interceptor.ServletRequestAware;
import service.OrgService;

/**
 *
 * @author luyang
 */
public class DeleteOrgAction  extends ActionSupport implements ServletRequestAware
{
    private HttpServletRequest request;
    private OrgService orgService;

    public String execute()
    {
        int id;
        String temp=(String)request.getParameter("id");
        if(temp.equals("")||temp==null)
            return ERROR;
        else
            id=Integer.parseInt(temp);
        
         orgService.deleteOrg(id);
      
         request.setAttribute("msg", "Success deleted!");
         System.out.println(request.getAttribute("msg"));
        return SUCCESS;
    }

    public void setOrgService(OrgService orgService)
    {
        this.orgService=orgService;
    }

    public void setServletRequest(HttpServletRequest request)
    {
        this.request=request;
    }

}
